import { shopList } from '@/api'

// search 模块的小仓库
const state = {
    searchlistData: [],
    // 分页总数量
    totalCount: ''
}
const mutations = {
    searchlistData(state, rel) {
        state.searchlistData = rel
        // 分页总数量
        state.totalCount = rel.total
    }
}
const actions = {
    async searchAction({ commit }, searchparams) {
        let result = await shopList(searchparams)
        commit("searchlistData", result.data)
    }
}
const getters = {
    // 当前形参state，当前仓库中的state，并非大仓库的state
    goodsList(state) {
        return state.searchlistData.goodsList || []
    },
    trademarkList(state) {
        return state.searchlistData.trademarkList || []
    },
    attrsList(state) {
        return state.searchlistData.attrsList || []
    }
}
export default {
    state,
    mutations,
    actions,
    getters
}